package util;

public class Page {
    private Integer pageIndex;
    private Integer pageSize;
    private Integer startRow;
    private Long totalCount;
    private Long totalPage;

    public Page(Integer pageIndex) {
        this.pageIndex = pageIndex;
        this.pageSize =3;
        this.startRow = (this.pageIndex-1) * this.pageSize;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getStartRow() {
        return startRow;
    }

    public void setStartRow(Integer startRow) {
        this.startRow = startRow;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
        this.totalPage = this.totalCount  % this.pageSize == 0?this.totalCount/ this.pageSize : this.totalCount / this.pageSize + 1;
    }

    public Long getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Long totalPage) {
        this.totalPage = totalPage;
    }
}
